package br.jus.tjpe.xml.marshall;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;

import br.jus.tjpe.ws.dominio.TcListaParte;
import br.jus.tjpe.ws.dominio.TcParteFisica;
import br.jus.tjpe.ws.dominio.TcParteJuridica;

public class Marshall {

	public static void main(String[] args) throws JAXBException,
			FileNotFoundException {
		JAXBContext jc = JAXBContext.newInstance("br.jus.tjpe.ws.dominio");
		// Create marshaller
		Marshaller m = jc.createMarshaller();
		// Marshal object into file.

		TcParteFisica parte1 = new TcParteFisica();
		parte1.setId(1L);
		parte1.setCpf("12321321321");
		parte1.setNome("Parte 1");

		TcParteJuridica parte2 = new TcParteJuridica();
		parte2.setId(2L);
		parte2.setCnpj("213213213");
		parte2.setRazaoSocial("Parte 2");
		
		TcListaParte tcListaParte = new TcListaParte();
		tcListaParte.getParte().add(parte1);
		tcListaParte.getParte().add(parte2);

		m.marshal(tcListaParte, new FileOutputStream("partes.xml"));
	}
}
